package com.service.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;

import com.bpms.common.CommonUtil;

public class BillPhoto {
	public static void save(String path,String filename, byte[] buffer) throws Exception {
		try {
			init_path(path);
			OutputStream os = new FileOutputStream(path + filename);
			os.write(buffer);
			os.close();
			CommonUtil.debug("BillPhoto save image file:" + path + filename + " sucess");
		} catch (Exception e) {
			CommonUtil.debug("BillPhoto save image file:" + path + filename + ",exception :", e);
			throw(e);
		}
	}
	
	public static void init_path(String path){
		if(path != null){
			new File(path).mkdirs();
		}
	}
}
